package com.ck.ck_back.utils;

import com.ck.ck_back.pojo.LikeProduction;
import com.ck.ck_back.service.likeproductionservice;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
public class likeproductionTask extends QuartzJobBean {
    @Resource
    private likeproductionservice likeproductionserviceimpl;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        List<LikeProduction> likeProductions = likeproductionserviceimpl.getLikedDataFromRedis();
        if (likeProductions.size()>0){
            likeproductionserviceimpl.deal_withdata(likeProductions);
        }else {
            log.info("暂无数据需要作品点赞数据存储");
        }

    }
}
